package com.luck.pf.framework.interceptor;

import java.util.Map;

import com.luck.pf.common.Constants;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AuthorityInterceptor extends AbstractInterceptor{
	private static final long serialVersionUID = -5249638582908136758L;

	public String intercept(ActionInvocation invocation) throws Exception {
		ActionContext ctx = invocation.getInvocationContext();
		Map session = ctx.getSession();
		String user = (String) session.get(Constants.SESSION_LOGIN_NAME);
		if(user == null || user.equals("")){
			ctx.put("alertInfo", "没有登录/登录过期!ͳ");
			return "siteAlertPage";
		}
		return invocation.invoke();
	}

}
